#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
const int N=1e3+10;
const int INF=0x3f3f3f3f;
int n,m,s;
vector<pair<int,int>> edge[N];
int st[N];
int dist[N];
struct cmp{
	bool operator()(const pair<int,int>& p1,const pair<int,int>& p2)
	{
		return p1.second>p2.second;
	}
};
int dijstra(int u){
	memset(dist,INF,sizeof(dist));
	memset(st,0,sizeof(st));
	dist[u]=0;
	priority_queue<pair<int,int>,vector<pair<int,int>>,cmp> q;
	q.push({u,0});
	while(q.size())
	{
		int t=q.top().first;
		q.pop();
		if(st[t])
			continue;
		st[t]=1;
		for(auto& e:edge[t])
		{
			int x=e.first;
			int w=e.second;
			if(dist[x]>dist[t]+w)
			{
				dist[x]=dist[t]+w;
				q.push({x,dist[x]});
			}
		}
	}
	return dist[s];
	
	
}
int main()
{
	
	while(cin>>n>>m>>s)
	{
		memset(edge,0,sizeof(edge));
		
		for(int i=0;i<m;i++)
		{
			int p,q,t;
			scanf("%d%d%d",&p,&q,&t);
			edge[p].push_back({q,t});
		}
		int w;
		cin>>w;
		
		for(int i=0;i<w;i++)
		{
			int t;
			scanf("%d",&t);
			edge[0].push_back({t,0});
		}
		
		int ret=INF;
		ret=min(ret,dijstra(0));
		if(ret==INF)
			cout<<-1<<endl;
		else 
			cout<<ret<<endl;	
	}
	
	
	return 0;
}
